package com.mooc.ppjoke.data;

import androidx.annotation.Nullable;
import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;

import java.io.Serializable;

/**
 * @ClassName: Comment$
 * @Description: java类作用描述
 * @Author: 魏靳元
 * @CreateDate: 2022/8/16 15:05
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
public class Comment extends BaseObservable implements Serializable {
    //神评

    public int id;
    public long itemId;
    public long commentId;
    public long userId;
    public int commentType;
    public long createTime;
    public int commentCount;
    public int likeCount;
    public String commentText;
    public String imageUrl;
    public String videoUrl;
    public int width;
    public int height;
    public boolean hasLiked;
    public User author;
    public Ugc ugc;

    @Bindable
    public Ugc getUgc(){
        if(ugc==null){
            ugc= new Ugc();
        }

        return ugc;}


    @Override
    public boolean equals(@Nullable Object obj) {
        if (obj == null || !(obj instanceof Comment))
            return false;

        Comment newComment = (Comment) obj;
        return likeCount == newComment.likeCount
                && hasLiked == newComment.hasLiked
                && (author != null && author.equals(newComment.author))
                && (ugc != null && ugc.equals(newComment.ugc));
    }


}
